// pages/Invitationandsharing/Invitationandsharing.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    info:[],
    Discount:null,
    OrderNo:null,
    goodsList:[],
    goodsListTotalPrice:0,
    finsTotalprice:0
  },
   //返回上一页
   navigateBack() {
    wx.navigateBack({
      delta: 1
    })
  },
  //返回首页
  navigateBackinx() {
  wx.switchTab({
    url: '/pages/index/index',
  })
},

  addsms(e){
    let that = this
    let OrderNo = that.data.OrderNo
      wx.navigateTo({
        url: '../smsInvitation/smsInvitation?OrderNo='+OrderNo,
      })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    let  userInfo=  wx.getStorageSync('userInfo')
    let  token=  wx.getStorageSync('token')
    let OrderNo = options.OrderNo
    let that = this
    console.log(options.OrderNo)
    //获得订单详情
    wx.request({
      url: 'https://www.yulonging.com/dwweb/wxapi.ashx',
      data: {
       //请求后台的分页数据
       cmd:'GetOrderInfo',
       token:token,
       OrderNo:OrderNo
      },
      method: "get",
      success(res) {
       var data = res.data.DATA;
       var goodsList = data[0].GoodsList
       let goodsListTotalPrice = 0
       goodsList.forEach((item, index) => {
        item.num = item.Nums
        item.totalPrice = item.Price * item.num
        goodsListTotalPrice += parseFloat(item.totalPrice)
      })
       console.log(data[0]);
       that.setData({
        OrderNo:OrderNo,
        finsTotalprice:data[0].RoomFeeDis*1+data[0].GoodsFee,
        goodsListTotalPrice:goodsListTotalPrice,
        goodsList:goodsList,
        info:data[0],
        Discount:data[0].Discount*10
       })
      }
   })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },
  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },
  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
      let that = this
      let OrderNo = that.data.OrderNo
      let  token=  wx.getStorageSync('token')
      return {
        title: '参会邀请',
        imageUrl:'/public/1.jpg',
        path: '/pages/fenxiang/fenxiang?id='+OrderNo,
      }
  }
})